<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <meta charset="utf-8">
  <title>操作员修改</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="../layuiadmin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="../layuiadmin/style/admin.css" media="all">
   <style>
  /* 这段样式只是用于演示 */
  #LAY-component-grid-list .layui-row .cmdlist-container{height: 250px;}
  </style>
</head>
<body>
 <div class="layui-fluid layadmin-cmdlist-fluid" id="LAY-component-grid-list">
  <div class="layui-row layui-col-space30">
    <div class="layui-col-md4 layui-col-sm4">
        <div class="cmdlist-container">
	    </div>
    </div>
    <div class="layui-col-md4 layui-col-sm4">
        <div class="cmdlist-container">
	    </div>
    </div>
    <div class="layui-col-md4 layui-col-sm4">
       <div class="cmdlist-container">
	    </div>
    </div>
    <div class="layui-col-md4 layui-col-sm4">
        <div class="cmdlist-container">
	    </div>
    </div>
    <div class="layui-col-md4 layui-col-sm4">
       <div class="cmdlist-container">
        	<div style="text-align: center;">
              <img src="../layuiadmin/layui/images/rollcall.png">
            </div>
            <br>
            <div style="text-align: center;">
    				<button class="layui-btn" lay-submit lay-filter="layuiadmin-operator-form-submit">开始点名</button>
		    </div>
	    </div>
    </div>
    <div class="layui-col-md4 layui-col-sm4">
        <div class="cmdlist-container">
	    </div>
    </div>
    <div class="layui-col-md4 layui-col-sm4">
        <div class="cmdlist-container">
        	<div style="text-align: center;">
            </div>
            <br>
            <div style="text-align: center;">
		    </div>
	    </div>
    </div>
    <div class="layui-col-md4 layui-col-sm4">
        <div class="cmdlist-container">
        	
	    </div>
    </div>
    <div class="layui-col-md4 layui-col-sm4">
        <div class="cmdlist-container">
        	
	    </div>
    </div>
    
	</div>
  </div>

  <script src="../layuiadmin/layui/layui.js"></script>  
  <script>
  layui.config({
    base: '../layuiadmin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'form', 'laydate'], function(){
	  var $ = layui.$
	    ,admin = layui.admin
	    ,element = layui.element
	    ,layer = layui.layer
	    ,laydate = layui.laydate
	    ,form = layui.form;
    
	laydate.render({
		elem: '#birthday', //弹出页的指定元素生日时期需要为时间格式
	});
	  
    //监听提交
    form.on('submit(layuiadmin-operator-form-submit)', function(obj){
      	var field = obj.field; //获取提交的字段
      	var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引  

      	//提交 Ajax 成功后，关闭当前弹层并重载表格
      	//$.ajax({});
      
      	layer.confirm('确定操作?', function(index){
      		layer.msg('正在提交请稍候。。。', {icon: 16,time:'-1',shade : [0.5 , '#000' , true]});
      		admin.req({
    		    url: '../rollcall/save' //实际使用请改成服务端真实接口
    	        ,data: field
    	        ,type: 'POST'
    	        ,done: function(res){
    	        	//20S倒计时，一般time的值跟i值保持一致，例如倒计时5s，=5,time=5,i只是起始的数字
                    layer.msg('', {
                        time: 10000,
                        shade: 0.5,
                        area:['150px', '150px'],
                        success: function (layero, index) {
                            var msg = layero.text();
                            var i = 10;
                            var timer = null;
                            var fn = function () {
                                layero.find(".layui-layer-content").text(i).css({'color':'red','font-size':'60px','margin-top':'50px'});
                                if (!i) {
                                    layer.close(index);
                                    clearInterval(timer);
                                }
                                i--;
                            };
                            timer = setInterval(fn, 1000);
                            fn();
                        },
                    }, function () {
                        //倒计时完成后需要执行的代码
                        //alert("倒计时执行完成");
                        if(res.flag == '1'){
                        	//layer.msg(res.uuid);
                        	parent.layui.index.openTabsPage("rollcallinfo/findByList?uuid="+res.uuid,"点名签到");
                        }else{
                        	layer.msg(res.msg);
                        }
                    });
    	        }
         	});
        });
      	
      	
      
        //parent.layui.table.reload('LAY-operator-content-list'); //重载表格
        //parent.layer.close(index); //再执行关闭 
    });
  })
  </script>
</body>
</html>